package pub.guoxin.oops.manager.vo;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import pub.guoxin.oops.model.User;
import pub.guoxin.oops.tidy.LocalDateDeserializer;
import pub.guoxin.oops.tidy.LocalDateSerializer;

import java.time.LocalDateTime;

/**
 * Created by guoxin on 18-1-30.
 */
@Data
public class GroupPageVo {

    private String id;

    @ApiModelProperty(value = "分组名称")
    private String name;

    @ApiModelProperty(value = "分组负责人联系方式")
    private String userMobile;

    @ApiModelProperty(value = "分组负责人名字")
    private String userName;

    @ApiModelProperty(value = "分组负责人ID")
    private String userId;

    @ApiModelProperty(value = "创建时间", required = true, hidden = true)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateSerializer.class)
    private LocalDateTime creation;

    public GroupPageVo(String id, String name, LocalDateTime creation, User user) {
        this.id = id;
        this.userMobile = user.getMobile();
        this.userName = user.getFirstname();
        this.name = name;
        this.userId = user.getId();
        this.creation = creation;
    }
}
